#if($msg)
<script>
alert('$!msg');
</script>
#end
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>文章列表</title>
<link href="/include/manage/images/main/style.css" rel="stylesheet" type="text/css" />
<link href="/include/manage/dialog/asyncbox.css" rel="stylesheet" type="text/css" />
<style type="text/css">
#spanButtonPlaceHolder{
	width:52px;
	height:20px;
	z-index:100;
}
#move{margin:8px;}
</style>
<script type="text/javascript" src="/include/manage/js/jquery.js"></script>
<script type="text/javascript" src="/include/manage/js/jquery.tablednd.js"></script>
<script type="text/javascript" src="/include/manage/js/AsyncBox.js"></script>
<script type="text/javascript" src="/include/manage/swfupload/swfupload.js"></script>
<script type="text/javascript" src="/include/manage/swfupload/swfupload.queue.js"></script>
<script type="text/javascript" src="/include/manage/swfupload/fileprogress.js"></script>
<script type="text/javascript" src="/include/manage/swfupload/imp_handlers.js"></script>
<script language="javascript">
var tid='$!tid';
function checkAll() {
	if($('#selAll').attr("checked")){
		$('input[type=checkbox]').attr('checked', $('#selAll').attr("checked")); 
	}else{
		$('input[type=checkbox]').attr('checked',false);
	}
}

function delSel(){
	if(confirm('确定要删除吗?')){
		var str='';
		$("input[name='sel_id']:checked").each(function(){
			str+=$(this).val()+",";
		});
		if(str.length>0){
			$('#deleteid').val(str);
			$('#delform').submit();
		}
	}
}

function deleteNews(id){
	if(confirm('确定要删除吗?')){
		location.href="/manage_news.ad?parameter=delete&id="+id;
	}
}

function searchNews(){
	var isaudit=$('#isaudit').val();
	var keywords=$('#key_words').val();
	location.href='/manage_news.ad?parameter=list&isaudit='+isaudit+'&key_words='+keywords+'&page=$!frontPage&tid=$!tid';
}

function cutSel(){
	var str='';
	$("input[name='sel_id']:checked").each(function(){
		str+=$(this).val()+",";
	});
	if(str.length>0){
		jQuery.get("/manage_news_ajax.ad" , { parameter : "cut", targetid : str }, function(data){
		});
	}
}

function copySel(){
	var str='';
	$("input[name='sel_id']:checked").each(function(){
		str+=$(this).val()+",";
	});
	if(str.length>0){
		jQuery.get("/manage_news_ajax.ad" , { parameter : "copy", targetid : str }, function(data){
		});
	}
}

function linkSel(){
	var str='';
	$("input[name='sel_id']:checked").each(function(){
		str+=$(this).val()+",";
	});
	if(str.length>0){
		jQuery.get("/manage_news_ajax.ad" , { parameter : "link", targetid : str }, function(data){
		});
	}
}

function pasteSel(){
	jQuery.get("/manage_news_ajax.ad" , { parameter : "paste",tid: "$!tid",treenews:"$!treenews"}, function(data){
		//window.location.reload();
		window.location='/manage_news.ad?parameter=list&tid='+tid+'&treenews=$!treenews';
	});
}
</script>
#if($tid)
<script language="javascript">
<!--
var nowOrder=null;
var swfu;

jQuery.ajaxSetup ({
	cache: false
});

function showRMenu(x, y) {
	$("#rMenu ul").show();
	$("#rMenu").css({"top":y+"px", "left":x+"px", "display":"block"});
}

function hideRMenu() {
	$("#rMenu").hide();
}

$(document).ready(function() {
    $(document).bind("contextmenu",function(e){
        return false;
    });
	
    $("#list").tableDnD({
		onDragClass: "startDrag",
		onDrop: function(table,row,target){
			var rows = table.tBodies[0].rows;
			if(target!=null){
				reArrange(row.id,target.id);
			}
        },
		dragHandle: "dragHandle"
	});
	
	$(".dragHandle").mousedown(function(e){
		if(3 == e.which){
			nowOrder=$(this.parentNode);
			//alert("这是右键单击事件："+nowOrder.id);
			showRMenu(e.clientX, e.clientY);
		}
	});
	
//初始化上传组件
			var settings = {
				flash_url : "/include/manage/swfupload/swfupload.swf",
				upload_url: "/DocImport?tid=$!tid",
				file_size_limit : "50 MB",
				file_types : "*.doc;*.docx;*.ppt;*.pptx;*.xls;*.xlsx;*.pdf",
				file_types_description : "办公文档",
				file_upload_limit : 100,
				file_queue_limit : 0,
				custom_settings : {
					progressTarget : "fsUploadProgress",
					cancelButtonId : "btnCancel"
				},
				debug: false,
				// Button settings
				button_width: "28",
				button_height: "22",
				button_placeholder_id: "spanButtonPlaceHolder",
				button_text: "导入",
				
				moving_average_history_size: 40,
				
				// The event handler functions are defined in handlers.js
				file_queued_handler : fileQueued,
				file_queue_error_handler : fileQueueError,
				file_dialog_complete_handler : fileDialogComplete,
				upload_start_handler : uploadStart,
				upload_progress_handler : uploadProgress,
				upload_error_handler : uploadError,
				upload_success_handler : uploadSuccess,
				upload_complete_handler : uploadComplete,
				queue_complete_handler : queueComplete	// Queue plugin event
			};

			swfu = new SWFUpload(settings);
});

function reArrange(oldId,newId){
	if(oldId!=newId){
		jQuery.get("/manage_news_ajax.ad" , { parameter : "order", tid : "$!tid" , oOrder : oldId , nOrder : newId } );
	}
}

function upOrder(){
	hideRMenu();
	if(nowOrder.prev().length!=0){
		if(nowOrder.prev().prev().length!=0){
			jQuery.get("/manage_news_ajax.ad" , { parameter : "order", tid : "$!tid" , oOrder : nowOrder[0].id , nOrder : nowOrder.prev()[0].id } );
			nowOrder.insertBefore(nowOrder.prev());
		}else{
			jQuery.get("/manage_news_ajax.ad" , { parameter : "order", tid : "$!tid" , nOrder : nowOrder[0].id },function(data){
				window.location.reload();
			});
		}
	}
}

function downOrder(){
	hideRMenu();
	if(nowOrder.next().length!=0){
		jQuery.get("/manage_news_ajax.ad" , { parameter : "order", tid : "$!tid" , oOrder : nowOrder[0].id , nOrder : nowOrder.next()[0].id } );
		nowOrder.insertAfter(nowOrder.next());
	}else{
		jQuery.get("/manage_news_ajax.ad" , { parameter : "order", tid : "$!tid" , oOrder : nowOrder[0].id },function(data){
			window.location.reload();
		});
	}
}

function goOrder(){
	hideRMenu();
	asyncbox.open({
		title : "移动文章",
		html : "<div id='move'><ul>"+
		"<li>移动至 第<input id=\"go_page\" name=\"go_page\" type=\"text\"/>页，第<input id=\"go_order\" name=\"go_order\" type=\"text\"/>条</li>"+
		"</ul></div>",
		width : 500,
		height : 300,
		tipsbar : {
			title : '移动文章',
			content : '将当前文章移动到指定位置'
　　},
		btnsbar : $.btn.OKCANCEL,
		callback : function(action){
			//判断action值
			if(action == 'ok'){
				var new_order=0;
				new_order=parseInt(($('#go_page').val()-1)*$pageSize)+parseInt($('#go_order').val())-1;
				if(new_order>=0){
					jQuery.get("/manage_news_ajax.ad" , { parameter : "getOrderNewsId", tid : "$!tid" , neworder : new_order},function(data){
						if(data.length>0){
							jQuery.get("/manage_news_ajax.ad" , { parameter : "order", tid : "$!tid" , oOrder : nowOrder[0].id, nOrder : data},function(data){
								window.location.reload();
							});
						}
					});
				}
			}
　　}
	});
}

function resetOrder(){
	jQuery.get("/manage_news_ajax.ad" , { parameter : "resetOrder", tid : "$!tid" },function(data){
		window.location.reload();
	});
}

function refreshPage(){
	hideRMenu();
	window.location.reload();
}

function r_cut(){
	hideRMenu();
	cutSel();
}

function r_copy(){
	hideRMenu();
	copySel();
}

function r_paste(){
	hideRMenu();
	pasteSel();
}

function importDoc(){
	asyncbox.open({
		title : "导入文档",
		html : "<div id='showStatus'><div class='fieldset flash' id='fsUploadProgress'><span class='legend'></span></div><div id='divStatus'>已上传0个文件</div></div>",
		width : 500,
		height : 300
	});
	//swfu.startUpload();
}
-->
</script>
#end
<style>
#if($tid)
<!--
.startDrag td{
	border-top:1px solid white;
	border-left:1px solid white;
	border-right:1px solid gray;
	border-bottom:1px solid gray;
	background-color:#F1F1F1;	
}
.dragHandle{
	cursor:move;
}
-->
#end
</style>
</head>
<body>
<form id="delform" name="delform" action="/manage_news.ad" method="post">
	<input type="hidden" name="parameter" value="delete" />
	<input type="hidden" id="deleteid" name="id" value="" />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="30" background="/include/manage/images/main/tab_05.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="12" height="30"><img src="/include/manage/images/main/tab_03.gif" width="12" height="30" /></td>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="30%" valign="middle"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="5%"><div align="center"><img src="/include/manage/images/main/tb.gif" width="16" height="16" /></div></td>
                <td width="95%"><span class="STYLE3">当前位置</span>：[内容管理]-[#if($thisType)$!thisType.name#else文章列表#end]</td>
              </tr>
            </table></td>
            <td width="70%"><table border="0" align="right" cellpadding="0" cellspacing="0">
              <tr>
              	#if($tid)
                <td width="55"><table border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td width="14"><div align="center"><a href="javascript:void(0)"><img src="/include/manage/images/main/imp.gif" width="14" height="14" /></a></div></td>
                    <td width="28"><div align="center"><a href="javascript:void(0)"><span id="spanButtonPlaceHolder">导入</span></a></div></td>
                  </tr>
                </table></td>
                #end
                <td width="55"><table border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td width="14"><div align="center"><a href="/manage_news.ad?parameter=add&tid=$!tid&treenews=$!treenews"><img src="/include/manage/images/main/22.gif" width="14" height="14" /></a></div></td>
                    <td width="28"><div align="center"><a href="/manage_news.ad?parameter=add&tid=$!tid&treenews=$!treenews">新增</a></div></td>
                  </tr>
                </table></td>
                <td width="55"><table border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td width="14"><div align="center"><a href="javascript:cutSel()"><img src="/include/manage/images/main/cut.gif" width="14" height="14" /></a></div></td>
                    <td width="28"><div align="center"><a href="javascript:cutSel()">剪切</a></div></td>
                  </tr>
                </table></td>
                <td width="55"><table border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td width="14"><div align="center"><a href="javascript:copySel()"><img src="/include/manage/images/main/copy.gif" width="14" height="14" /></a></div></td>
                    <td width="28"><div align="center"><a href="javascript:copySel()">复制</a></div></td>
                  </tr>
                </table></td>
								<td width="55"><table border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td width="14"><div align="center"><a href="javascript:linkSel()"><img src="/include/manage/images/main/link.gif" width="14" height="14" /></a></div></td>
                    <td width="28"><div align="center"><a href="javascript:linkSel()">引用</a></div></td>
                  </tr>
                </table></td>
                <td width="55"><table border="0" cellpadding="0" cellspacing="0">
                  <tr>
										#if($copyType)
                    <td width="14"><div align="center"><a href="javascript:pasteSel()"><img src="/include/manage/images/main/paste.gif" width="14" height="14"/></a></div></td>
                    <td width="28"><div align="center"><a href="javascript:pasteSel()">粘贴</a></div></td>
										#else
										<td width="14"><div align="center"><img src="/include/manage/images/main/paste.gif" width="14" height="14" style="filter:gray; -moz-opacity:.4;" /></div></td>
                    <td width="28"><div align="center">粘贴</div></td>
										#end
                  </tr>
                </table></td>
                #if($pop>0)
                <td width="55"><table border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td width="14"><div align="center"><a href="javascript:delSel()"><img src="/include/manage/images/main/11.gif" width="14" height="14" /></a></div></td>
                    <td width="28"><div align="center"><a href="javascript:delSel()">删除</a></div></td>
                  </tr>
                </table></td>
                #end
								<td width="55"><table border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td width="14"><div align="center"><a href="javascript:resetOrder()"><img src="/include/manage/images/main/order.gif" width="14" height="14" /></a></div></td>
                    <td width="28"><div align="center"><a href="javascript:resetOrder()">排序</a></div></td>
                  </tr>
                </table></td>
								<td width="220"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                  	<td>
                    	搜索:
                    </td>
                    <td>
											<select id="isaudit" name="isaudit">
												<option value="-1">所有</option>
												<option value="0" #if($isaudit==0) selected#end>未审核</option>
												<option value="1" #if($isaudit==1) selected#end>已审核</option>
											</select>
                    	<input id="key_words" type="text" name="key_words" value="$!key_words" size="8" style="height:16px;border:1px solid #999999;" /></td>
                    <td><a href="javascript:searchNews()"><img src="/include/manage/images/main/search.gif" /></a></td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
        <td width="16"><img src="/include/manage/images/main/tab_07.gif" width="16" height="30" /></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="8" background="/include/manage/images/main/tab_12.gif">&nbsp;</td>
        <td><table id="list" width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#b5d6e6">
          <tr class="nodrop nodrag">
            <td width="24" height="22" background="/include/manage/images/main/bg.gif"><div align="center">
              <input type="checkbox" name="selAll" id="selAll" onClick="checkAll()" />
            </div></td>
            <td width="32" background="/include/manage/images/main/bg.gif"><div align="center"><label for="selAll">全选</label></div></td>
            <td width="*" background="/include/manage/images/main/bg.gif"><div align="center">文章标题</div></td>
            <td width="60" background="/include/manage/images/main/bg.gif"><div align="center">发布人</div></td>
            <td width="130" background="/include/manage/images/main/bg.gif"><div align="center">发布时间</div></td>
						<td width="100" background="/include/manage/images/main/bg.gif"><div align="center">状态</div></td>
            #if($thisType.tree)
            #if($thisType.tree.length()>0)
            <td width="80" background="/include/manage/images/main/bg.gif"><div align="center">附加分类</div></td>
            #end
            #end
            <td width="220" background="/include/manage/images/main/bg.gif"><div align="center">基本操作</div></td>
          </tr>
#foreach ($news in $newsList)
          <tr id="$!news.id">
            <td height="20" bgcolor="#FFFFFF"><div align="center">
              <input type="checkbox" name="sel_id" value="$!news.id" />
            </div></td>
            <td class="dragHandle" bgcolor="#FFFFFF" align="center">
            #if($news.fileType)
            	<img src="/include/system/filetype/$news.fileType.toLowerCase()" />
            #else
            	<img src="/include/system/filetype/html.gif" />
            #end
            </td>
            <td bgcolor="#FFFFFF">
            	#if($pop==0 && $news.display==1)
            	$!news.getTitle(30)
            	#else
            	<a href="/manage_news.ad?parameter=edit&id=$!news.id" title="$!news.title">$!news.getTitle(30)</a>
            	#end
            </td>
            <td bgcolor="#FFFFFF" align="center">$!news.username</td>
            <td bgcolor="#FFFFFF">$!news.date</td>
						<td bgcolor="#FFFFFF" align="center">
							#if($news.display==1)<font color="green">已审核</font>#else<font color="red">未审核</font>#end &nbsp;
							#if($news.ispub==1)<font color="green">已发布</font>#elseif($news.ispub==2)<font color="gray">已下线</font>#else<font color="red">未发布</font>#end
						</td>
            #if($thisType.tree)
            #if($thisType.tree.length()>0)
            <td bgcolor="#FFFFFF">
            	[<a href="/manage_news.ad?parameter=tree&tree_id=$thisType.tree&treenews=$!news.id">进入编辑</a>]
            </td>
            #end
            #end
            <td bgcolor="#FFFFFF" align="center">
            #if($pop==0 && $news.display==1)
            	无编辑权限
            #else
            <a href="/manage_news.ad?parameter=edit&id=$!news.id"><img src="/include/manage/images/main/edt.gif" width="16" height="16" align="absmiddle" />编辑</a>&nbsp; &nbsp;<a href="javascript:deleteNews('$!news.id')"><img src="/include/manage/images/main/del.gif" width="16" height="16" align="absmiddle" />删除</a>&nbsp; &nbsp; 
            #end
            #if($pop==3)
                #if($news.commend.equals("1"))
                    <a href="/manage_news.ad?parameter=noCommend&id=$!news.id">取消推荐</a>
                #else
                    <a href="/manage_news.ad?parameter=commend&id=$!news.id"><img src="/include/manage/images/main/rec.gif" width="16" height="16" align="absmiddle" />推荐</a>
                #end
            #end
						&nbsp; &nbsp; 
						<a href="/news.do?parameter=preview&id=$!news.id" target="_blank">预览</a>
        </td>
          </tr>
#end
        </table></td>
        <td width="8" background="/include/manage/images/main/tab_15.gif">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="35" background="/include/manage/images/main/tab_19.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="12" height="35"><img src="/include/manage/images/main/tab_18.gif" width="12" height="35" /></td>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td class="STYLE4">&nbsp;&nbsp;共有 $!rows 条记录，当前第 $!currentPage/$!totalPage 页</td>
            <td><table border="0" align="right" cellpadding="0" cellspacing="0">
                <tr>
                  <td width="40"><a href="/manage_news.ad?parameter=page&page=1&tid=$!tid&treenews=$!treenews&keywords=$!keywords"><img src="/include/manage/images/main/first.gif" width="37" height="15" /></a></td>
                  <td width="45">#if($frontPage<1)<img src="/include/manage/images/main/back-no.gif" width="43" height="15" />#else<a href="/manage_news.ad?parameter=page&page=$!frontPage&tid=$!tid&treenews=$!treenews&key_words=$!key_words"><img src="/include/manage/images/main/back.gif" width="43" height="15" /></a>#end</td>
                  <td width="45">#if($nextPage>$totalPage)<img src="/include/manage/images/main/next-no.gif" width="43" height="15" />#else<a href="/manage_news.ad?parameter=page&page=$!nextPage&tid=$!tid&treenews=$!treenews&key_words=$!key_words"><img src="/include/manage/images/main/next.gif" width="43" height="15" /></a>#end</td>
                  <td width="40"><a href="/manage_news.ad?parameter=page&page=$!totalPage&tid=$!tid&treenews=$!treenews&key_words=$!key_words"><img src="/include/manage/images/main/last.gif" width="37" height="15" /></a></td>
                  <td width="100"><div align="center"><span>转到第
                    <input id="goPage" name="goPage" type="text" size="4" style="width:20px;height:16px;border:1px solid #999999;" /> 
                    页 </span></div></td>
                  <td width="40"><a href="javascript:location.href='/manage_news.ad?parameter=page&tid=$!tid&treenews=$!treenews&key_words=$!key_words&page='+document.getElementById('goPage').value"><img src="/include/manage/images/main/go.gif" width="37" height="15" /></a></td>
                </tr>
            </table></td>
          </tr>
        </table></td>
        <td width="16"><img src="/include/manage/images/main/tab_20.gif" width="16" height="35" /></td>
      </tr>
    </table></td>
  </tr>
</table>
</form>
<div id="rMenu" style="position:absolute; display:none;">
	<ul id="m_up"><li><a href="javascript:upOrder()">上移</a></li></ul>
	<ul id="m_down"><li><a href="javascript:downOrder()">下移</a></li></ul>
	<ul id="m_go"><li><a href="javascript:goOrder()">移至..</a></li></ul>
	<ul id="m_cut"><li><a href="javascript:r_cut()">剪切</a></li></ul>
	<ul id="m_copy"><li><a href="javascript:r_copy()">复制</a></li></ul>
	<ul id="m_pase"><li><a href="javascript:r_paste()">粘贴</a></li></ul>
	<ul id="m_refresh"><li><a href="javascript:refreshPage()">刷新</a></li></ul>
</div>
</body>
</html>